import ajax from './request.config'
export const getpartnerTable = ({
    name,
    province,
    city,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.post('/partner/partnerList', {

    name,
    province,
    city,
    startTime,
    endTime,
    pageNumber,
    pageSize

})
export const saveCustomerInfo = ({
    uuid,
    name,
    logo_name,
    brand_name,
    linkman,
    contact_number,
    image_url,
    province,
    city
}) => ajax.post('/partner/save', {
    uuid,
    name,
    logo_name,
    brand_name,
    linkman,
    contact_number,
    image_url,
    province,
    city
})
export const getPartnerModules = partnerCode => ajax.get('/partner/getModulesData', { params: { partnerCode } })
export const deletePartnerModule = uuid => ajax.post('/partner/deletePartnerModule', { uuid })
export const addPartnerModules = (partnerCode, moduleUuids) => ajax.post('/partner/partnerModuleAdd', { partnerCode, moduleUuids })
export const getNewModules = partnerCode => ajax.get('/partner/gotoAddModulesPage', { params: { partnerCode } })

//获取客户模块分组信息树
export const getModuleGroupInfo = partnerCode => ajax.get('/partner/partnerGroupTreeData', { params: { partnerCode } })
export const deleteModuleGroup = uuid => ajax.post('/partner/deleteGroupOrModule', { uuid })
export const addSaveGroup = ({
    uuid,
    partnerCode,
    groupName,
    seq
}) => ajax.post('/partner/partnerGroupSave', {
    uuid,
    partnerCode,
    groupName,
    seq
})
export const getAllModules = (partnerCode, group_uuid) => ajax.get('/partner/editGroupModule', { params: { partnerCode, group_uuid } })
export const saveModules = ({
    groupUUID,
    module_uuid,
    sizes,
    seq
}) => ajax.post('/partner/groupModuleAdd', {
    groupUUID,
    module_uuid,
    sizes,
    seq
})
export const getBannerList = partnerCode => ajax.get('/partner/setBanner', { params: { partnerCode } })
export const switchBanner = (partnerCode, bannerState) => ajax.post('/partner/bannerOpenOrClose', { partnerCode, bannerState })
export const setBanner = (partnerCode, banner_uuid) => ajax.post('/partner/partnerBannerAdd', { partnerCode, banner_uuid })
    //获取服务商列表
export const getServiceList = partnerCode => ajax.get('/partner/getServicesData', { params: { partnerCode } })
    //删除客户的某个服务商
export const deletePartnerService = uuid => ajax.post('/facilitator/deletePartnerService', { uuid })
    //获取未关联的服务商列表
export const getNoServiceList = partnerCode => ajax.get('/partner/gotoAddServicePage', { params: { partnerCode } })
export const addServiceForCus = ({ partnerCode, provider_uuid }) => ajax.post('/partner/partnerServiceAdd', { partnerCode, provider_uuid })
    //供应商
export const getProviderList = partnerCode => ajax.get('/partner/getSupplierData', { params: { partnerCode } })
export const deletePartnerProvider = uuid => ajax.post('/facilitator/deletePartnerSupplier', { uuid })
export const getNoProviderList = partnerCode => ajax.get('/partner/gotoAddSupplierPage', { params: { partnerCode } })
export const addProviderForCus = ({ partnerCode, supplier_uuid }) => ajax.post('/partner/partnerSupplierAdd', { partnerCode, supplier_uuid })
    //维修配置
export const getRepaireConfig = partnerCode => ajax.get('/partner/gotoSetModule', { params: { partnerCode } })
export const saveRepaireConfig = ({
        partnerCode,
        process_distance,
        time_max_distribute,
        time_max_take_order,
        time_max_process,
        time_max_score,
        receiptforecast
    }) => ajax.post('/partner/partnerWarningSave', {
        partnerCode,
        process_distance,
        time_max_distribute,
        time_max_take_order,
        time_max_process,
        time_max_score,
        receiptforecast
    })
    //巡检配置
export const getParnterInspectionList = (partnerCode, pageNumber, pageSize) => ajax.get('/partner/inspectionlist', { params: { partnerCode, pageNumber, pageSize } })
export const deleteTempInspection = uuid => ajax.post('/partner/inspectionDelete', { uuid })
export const getNoInspectionList = (partnerCode, pageNumber, pageSize) => ajax.get('/partner/gotoAddInspection', { params: { partnerCode, pageNumber, pageSize } })
export const addTempSave = (partnerCode, inspection_name) => ajax.post('/partner/inspectionAdd', { partnerCode, inspection_name })

//办公用品配置
export const getOffConfig = partnerCode => ajax.get('/partner/officeList', { params: { partnerCode } })
export const saveOffConfig = (partnerCode, approverNum, officeForecast) => ajax.post('/partner/saveOfficeForecast', { partnerCode, officeForecast, approverNum })
    //凭证
export const getPzConfig = partnerCode => ajax.get('/partner/credentialList', { params: { partnerCode } })
export const savePzConfig = (partnerCode, voucherApproverNum, credentialForecast) => ajax.post('/partner/saveCredentialForecast', { partnerCode, voucherApproverNum, credentialForecast })


//服务商
export const getServiceListTable = ({
    name,
    serviceScope,
    status,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/service/list', {
    params: {
        name,
        serviceScope,
        status,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})
export const freezonService = (uuid, flag) => ajax.post('/service/freezon', { uuid, flag })
export const getServiceObj = uuid => ajax.get('/service/serviceObject', { params: { uuid } })
export const saveAddService = ({
        uuid,
        name,
        brand_name,
        linkman,
        contact_number,
        image_url,
        serviceScope
    }) => ajax.post('/service/save', {
        uuid,
        name,
        brand_name,
        linkman,
        contact_number,
        image_url,
        serviceScope
    })
    //供应商
export const getProvideListTable = ({
    name,
    supplyScope,
    status,
    startTime,
    endTime,
    pageNumber,
    pageSize
}) => ajax.get('/supplierMng/list', {
    params: {
        name,
        supplyScope,
        status,
        startTime,
        endTime,
        pageNumber,
        pageSize
    }
})
export const freezonProvide = (uuid, flag) => ajax.post('/supplierMng/freezon', { uuid, flag })
export const getProvideObj = uuid => ajax.get('/supplierMng/supplyScope', { params: { uuid } })
export const saveAddProvide = ({
    uuid,
    name,
    email,
    linkman,
    contact_number,
    image_url,
    supplyScope
}) => ajax.post('/supplierMng/save', {
    uuid,
    name,
    email,
    linkman,
    contact_number,
    image_url,
    supplyScope
})